package com.nbsaas.boot;

import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager;
import java.util.List;

public class ScriptEngineInfo {

    public static void main(String[] args) {
        ScriptEngineManager manager = new ScriptEngineManager();
        List<ScriptEngineFactory> factories = manager.getEngineFactories();

        if (factories.isEmpty()) {
            System.out.println("当前 JVM 上没有可用的 JSR-223 脚本引擎");
        }

        for (ScriptEngineFactory factory : factories) {
            System.out.println("引擎名称: " + factory.getEngineName());
            System.out.println("引擎版本: " + factory.getEngineVersion());
            System.out.println("语言名称: " + factory.getLanguageName());
            System.out.println("语言版本: " + factory.getLanguageVersion());
            System.out.println("支持的名称: " + factory.getNames());
            System.out.println("--------------------------------------------------");
        }
    }
}
